<!DOCTYPE html>
<html>
	<head>
		<#include "/templates/commons/head.html">
		<script type="text/javascript">
			require(['${ctx!}/scripts/common/main.js'], function() {
			    require(['defineTree'], function(defineTree) {
					var menuTree = '${menuTree!""}';
					menuTree = JSON.parse(menuTree);
					loadTreeObj(menuTree, '${selTypeIds!""}');
				});
			});
		    /**
		     *点击添加按钮进入添加页面
		     */
		    function dialogSave(_callback) {
				var treeObj = $fnzTree.getZTreeObj("tree");
				var nodes = treeObj.getCheckedNodes(true);
				var ids = '';
				for (var i = 0; i < nodes.length; i++) {
			    	if (i == 0) {
						ids = nodes[i].id;
			    	} else {
						ids = ids + ',' + nodes[i].id;
			    	}
				}
				var messages = '确定要给菜单分配权限？';
				layer.confirm(messages, {
			    	btn : [ '确定', '取消' ]
				}, function() {
				    Common.network("${ctx!}/OrgController/authMenuToOrg.do?ids=" + ids, "POST", $(document.addForm).serialize(), false, _callback);
				}, function() {}
				);
		    }
		    /**
		     *点击返回按钮进入用户列表页面
		     */
		    function goBack() {
				document.opForm.action = "${ctx!}/OrgController/queryList.do";
				document.opForm.submit();
		    }
		</script>
		<style type="text/css">
			#addForm {
				height: 100%;
			}
			#extTreeDiv {
				width: 90%;
				border: 1px solid #7eabcd;
				background-color: #FFF;
				font-size: 12px;
				margin-left: 5%;
				height: 99%;
				overflow-y: auto;
			}
			
			#terTree {
				margin: 5px 5px 10px 5px;
			}
			
			.ztree {
				width: 98%;
				height: 93%;
				overflow: auto;
			}
		</style>
	</head>
	<body style="background: #f9f9f9; overflow: hidden;">
		<form id="addForm" name="addForm" class="layui-form" method="post" modelAttribute="orgBean">
			<div id="extTreeDiv">
				<!-- 选择树DOM -->
				<div id="terTree">
					<ul id="tree" class="ztree"></ul>
				</div>
				<input type="hidden" name="orgId" value="${orgIds?join(',')}">
			</div>
		</form>
	</body>
</html>